package com.bdqn.gulimall.seckill.scheduled;

import com.bdqn.gulimall.seckill.service.SeckillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * SeckillSkuScheduled
 * 秒杀商品定时上架
 *  每晚3点，上架最近三天需要秒杀的商品
 *  明天00:00:00 —— 23：59：59
 *  后天00:00:00 —— 23：59：59
 *  大后天00:00:00 —— 23：59：59
 * @author f
 * @since 2022/3/11
 */

@Slf4j
@Service
public class SeckillSkuScheduled {

    @Resource
    SeckillService seckillService;

    @Scheduled(cron = "0 0 3 * * ?")
    public void uploadSeckillSkuLatest3Days(){
        // 3天内重复上架商品无需处理
        seckillService.uploadSeckillSkuLatest3Days();

    }
}
